package com.snail.starter.mq.feign;

import com.snail.starter.mq.feign.request.LocalMessageConsumerRequest;
import com.snail.starter.mq.feign.request.LocalMessageRequest;
import com.snail.starter.mq.feign.response.LocalMessageConsumerResponse;
import com.snail.starter.mq.feign.response.LocalMessageProducerResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author: snail framework
 * @Date: 2023/7/4 13:53
 * @Version: 1.0.0
 */
@FeignClient(value = "message-server", contextId = "starterLocalMessageFeignInterface", path = "/local-message")
public interface LocalMessageFeignInterface {

    @PostMapping("/producer")
    Long addByProducer(@RequestBody LocalMessageRequest localMessageProducerRequest);

    @PutMapping("/{messageId}/status/{status}/producer")
    boolean modifyStatusByProducer(@PathVariable("messageId") Long messageId, @PathVariable("status") Integer status);

    @PutMapping("/tenant/{tenantId}/{messageId}/status/{status}/producer")
    boolean modifyStatusByProducerTenantId(@PathVariable("tenantId") Long tenantId, @PathVariable("messageId") Long messageId, @PathVariable("status") Integer status);

    @GetMapping("/{producerMessageId}/producer")
    LocalMessageProducerResponse getOneByMessageIdProducer(@PathVariable("producerMessageId") Long producerMessageId);

    @PostMapping("/consumer")
    Long addByConsumer(@RequestBody LocalMessageConsumerRequest localMessageConsumerRequest);

    @PutMapping("/{consumerMessageId}/status/{status}/consumer")
    boolean modifyStatusByConsumer(@PathVariable("consumerMessageId") Long consumerMessageId, @PathVariable("status") Integer status);

    @PutMapping("/tenant/{tenantId}/{consumerMessageId}/status/{status}/consumer")
    boolean modifyStatusByConsumerTenantId(@PathVariable("tenantId") Long tenantId, @PathVariable("consumerMessageId") Long consumerMessageId, @PathVariable("status") Integer status);

    @GetMapping("/{consumerMessageId}/consumer")
    LocalMessageConsumerResponse getOneByMessageIdConsumer(@PathVariable("consumerMessageId") Long consumerMessageId);

}